/**
 * Copyright (c) 2008 michiyasu wada
 * http://www.seyself.com/
 * 
 * Distributed under The MIT License.
 * [http://www.opensource.org/licenses/mit-license.php]
 */

package demo.scenes 
{
import demo.objects.OverlayPageCast;
import jp.progression.commands.AddChild;
import jp.progression.commands.RemoveChild;
import jp.progression.scenes.SceneObject;



public class SubPageScene extends SceneObject
{
    //--------------------------------------------------------------------------
    //  Properties
    //--------------------------------------------------------------------------
    private var _CastClass:Class;
    private var _cast:OverlayPageCast;
    
    //--------------------------------------------------------------------------
    //  Constructor
    //--------------------------------------------------------------------------
    public function SubPageScene(name:String, title:String, castClass:Class ) 
    {
        super(name);
        this.title = title;
        _CastClass = castClass;
    }
    
    //--------------------------------------------------------------------------
    //  Override Method
    //--------------------------------------------------------------------------
    override protected function _onInit():void
    {
        _cast = new _CastClass( progression.departedSceneId );
        addCommand(
            new AddChild( Main.cast , _cast, true )
        );
    }
    
    override protected function _onGoto():void
    {
        addCommand(
            new RemoveChild( Main.cast , _cast, true )
        );
        _cast = null;
    }
    
}

}